#!/usr/bin/env python

import sys, wx

class CloseWindow:
    def __init__(self, mainWin):
        if mainWin.fileSaved or \
            UserMessage.ask(_("There are unsaved changes. Close anyway?"),
                          _("Are you sure?")) == wx.ID_YES:
            mainWin.userSettings.writeConf(mainWin.currentFile)
            mainWin.userSettings.anyErrors()
#            del mainWin.fileHist
            mainWin.Destroy()
            sys.exit()